package com.neborosoft.lib.collections.tree;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: CM
 * Date: 16.02.13
 * Time: 2:13
 * To change this template use File | Settings | File Templates.
 */
public abstract class MultiStepsNavigationTree<T> extends NTree<T>{
    public static final int DEFAULT_STEPS_COUNT = -1;

    private int stepsCount = DEFAULT_STEPS_COUNT;

    protected MultiStepsNavigationTree(int levelsCount) {
        super(levelsCount);
    }

    protected MultiStepsNavigationTree(List<T> rootItems, int levelsCount) {
        super(rootItems, levelsCount);
    }

    public final int getDefaultLevelStepsCountFromParentToChild(T parent, int level){
        if(stepsCount == DEFAULT_STEPS_COUNT) {
            return super.getLevelStepsCountFromParentToChild(parent, level);
        } else {
            return stepsCount;
        }
    }

    @Override
    public int getLevelStepsCountFromParentToChild(T parent, int level) {
        return getDefaultLevelStepsCountFromParentToChild(parent, level);
    }

    public int getStepsCount() {
        return stepsCount;
    }

    public void setStepsCount(int stepsCount) {
        this.stepsCount = stepsCount;
    }
}
